package com.face.service;

import com.face.common.Page;
import com.face.dao.VisitDao;
import com.face.entity.Visit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class VisitService {

    @Autowired
    private VisitDao visitDao;

    public Page<Map<String, Object>> getVisitCountList(String shopId, Integer page, Integer limit, String start, String end) {
        if (start == null || start.isEmpty() || end == null || end.isEmpty()) {
            return visitDao.getVisitCountList(shopId, page, limit);
        }
        return visitDao.getVisitCountList(shopId, page, limit, start, end);
    }

    public Page<Visit> findByUserId(String shopId, String userId, Integer page, Integer limit, String start, String end) {
        if (start == null || start.isEmpty() || end == null || end.isEmpty()) {
            return visitDao.findByUserId(shopId, userId, page, limit);
        }
        return visitDao.findByUserId(shopId, userId, page, limit, start, end);
    }

    public Map<String, Object> findForWechatToRemark(String userId) {
        return visitDao.findForWechatToRemark(userId);
    }

}
